﻿using System;
using System.Web.Security;
using System.Security.Cryptography;

public partial class System_Pages_MyAccount_ChangePassword : SiteFox.Base.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void lib_Save_Click(object sender, EventArgs e)
    {
        SiteFox.Business.Model.User _User = this.CurrentUser();
        if (_User.Password == SiteFox.Business.Manager.User.GetSHA512(ucc_CurrentPassword.Value))
        {
            _User.Password = SiteFox.Business.Manager.User.GetSHA512(tb_Password_Value.Text);
            SiteFox.Business.Manager.User.Edit(_User);
            ucc_Message.Value = "Password changed.";
        }
        else 
        {
            ucc_Message.Value = "Old password not correct.";
        }
    }
}